package com.paradogs.framework.core.config;

import com.paradogs.framework.core.queue.*;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * @author: yumi
 * @date: 2023/8/3  11:21
 * @Description: TODO
 */
@AutoConfiguration
public class QueueConfiguration {

    @Bean
    @Scope("prototype")
    @ConditionalOnMissingBean(DBConsumer.class)
    public DBConsumer dbConsumer() {
        return new DBConsumer();
    }

    @Bean
    public QueueProperties queueProperties() {
        return new QueueProperties();
    }

    @Bean
    public PRQueueHolder prQueueHolder(QueueProperties queueProperties) {
        PRQueueHolder queueManager = new PRQueueHolder();
        queueManager.setQueueProperties(queueProperties);
        return queueManager;
    }


}
